/*
 * @Author: lkts
 * @Date: 2020-08-17 15:06:41
 * @LastEditTime: 2020-08-18 11:06:41
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \src\datalib\SeqList\SeqList.h
 */
#pragma once

#include "../../common/Status.h"
#include <stdio.h>
#include <stdlib.h>

#define LIST_INI_SIZE 100
#define LISTINCREMENT 10

typedef int ElemType;

typedef struct
{
  ElemType *elem;
  int length;
  int listsize;
} SeqList;

Status InitList(SeqList *L);
Status DestroyList(SeqList *L);
Status ClearList(SeqList *L);

Status IsEmpty(SeqList L);
Status Getlength(SeqList L);

Status GetElementAt(SeqList L, int i, ElemType *e);
int LocateElem(SeqList L, ElemType e, Status(Compare)(ElemType, ElemType));

Status PriorElemet(SeqList L, ElemType cur_e, ElemType *pre_e);
Status NextElement(SeqList L, ElemType cur_e, ElemType *nxt_e);

Status ListInsert(SeqList *L, int i, ElemType e);
Status ListDelete(SeqList *L, int i, ElemType *e);

void ListTraverse(SeqList L, void(Visit)(ElemType));